/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ttt.nor2.db;

import com.ttt.nor2.util.ExceptionUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Hashtable;
import org.apache.log4j.Logger;

/**
 *
 * @author anuphabm
 */
public class HtbALarmWorkDay {

    private Logger logger = Logger.getLogger(HtbALarmWorkDay.class);
    private Connection  conn;
    private Hashtable ht;
    public HtbALarmWorkDay(Connection conn) {
        this.conn = conn;
        ht = new Hashtable();
    }

    public void loadData(){
        
        try{
            String sql = "select * where status_alarm='Y'";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            ResultSet rs = pstmt.executeQuery();
            while(rs.next()){
                ALarmWorkDay alarm = new ALarmWorkDay();
                alarm.setTimeb(rs.getString("time_alarm_b"));
                alarm.setTimee(rs.getString("time_alarm_e"));
                String key = rs.getString("alarm_num") + "@" + rs.getString("day_alarm");
                ht.put(key, alarm);
            }
            rs.close();
            pstmt.close();

        }catch(Exception e){
            logger.error("Exception query work alarm error " + ExceptionUtil.getStackTrace(e));
        }

    }

    public Hashtable getALarm(String alum_num , String dayOnWeek){
        Hashtable htAlarm = new Hashtable();

        return htAlarm;
    }


}
